#pragma once
#include "stdafx.h"
#include "INITGUID.H"
#define SAFE_RELEASE(i) {if (i) i->Release(); i = NULL;}	
class SamsungFreeCodecFilterConnection
{
public:
	SamsungFreeCodecFilterConnection(void);
	~SamsungFreeCodecFilterConnection(void);

	// Filter connection
	static HRESULT ConnectFilters(
	IGraphBuilder* pGB,		// GraphBuilder Interface
	IBaseFilter* pUpFilter,		// Upper filter in data stream
	int nOutputPinOrder,		// Output pin order number in upper filter
	IBaseFilter* pDownFilter,		// Lower filter in data stream 
	int nInputPinOrder,			// Input pin order number in upper filter
	LPSTR pLogFile,			// Log file name of saving errors
	BOOL bManual);
	
	// Add filter by ClassId
	static HRESULT AddFilterByCLSID(
								IGraphBuilder *pGraph,      // Pointer to the Filter Graph Manager.
								REFGUID clsid,              // CLSID of the filter to create.
								IBaseFilter **ppF,          // Receives a pointer to the filter.
								LPCWSTR wszName             // A name for the filter (can be NULL).
								);

	//Filter Deleted
	static void DeleteFilter(IGraphBuilder *pigb, IBaseFilter *spf, int flag);
	//Render output pin
	static int RenderOutputPins(IGraphBuilder *pGB, IBaseFilter* pBaseFilter );
	//Checking filter
	void CheckFilter(IGraphBuilder *pGB);
	//Get FisrtFilter of DSoundRender 
	static CString GetSoundRenderer();

	// Render file to Ouput device
	static HRESULT Make_MyFree_Render(	IGraphBuilder *pigb, 
										LPWSTR szFile, 
										LPSTR err_msg,
										CWnd *pParentWnd, 
										CRect pRect,
										IBaseFilter *pVmr,
										IVMRWindowlessControl9  *pWC,
										IVMRFilterConfig9 *pConfig
										/*,IBasicAudio   *pAudio*/);

};
